package com.yunbao.ioc.bd;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

/**
 * Created by louisyuu on 2020/3/3 下午3:23
 */
public class DefaultBeanDefinitionRegistry implements BeanDefinitionRegistry {


    private static final Map<String, BeanDefinition> beanDefinitions = new HashMap<>();


    @Override
    public void registerBeanDefinitions(BeanDefinition beanDefinition) {
        beanDefinitions.put(beanDefinition.getId(), beanDefinition);

    }


    @Override
    public BeanDefinition getBeanDefinition(String id) {
        return beanDefinitions.get(id);
    }

    @Override
    public Collection<BeanDefinition> getBeanDefinitions() {
        return beanDefinitions.values();
    }
}
